import React, { Component } from 'react'
import { hashHistory } from 'react-router'
import { Carousel, Icon } from 'antd-mobile'
import { TopBanner, RowLineText, FooterTab, Calendar } from '../common'
import { NewsList, CalendarList } from './'

export default class FinancePage extends Component {
  constructor() {
    super()
    this.renderViaCondition = this.renderViaCondition.bind(this)
    this.state = {
      activeIndex: 0,
    }
  }
  render() {
    return (
      <div className={`rt-finance-container`}>
        <TopBanner />

        <RowLineText
          lft={'新闻'}
          rgt={'日历'}
          onChange={i => {
            this.setState({
              activeIndex: i,
            })
          }}
        />
        {this.renderViaCondition()}
        <FooterTab defaultActiveIndex={3} />
      </div>
    )
  }
  renderViaCondition() {
    const { activeIndex } = this.state
    switch (activeIndex) {
      case 0: return <NewsList />
      case 1: return <CalendarList />
      default: return null
    }
  }
}